﻿/**
 * Proyecto: Cognitum
 * Global IT Services 2008
 * @author
 */
Cognitum.Polizas.Siniestro.Editor = Ext.extend(Karma.EBCard, {

    sections: [{
        title: 'Datos generales',
        items: [{
            fieldLabel: 'Numero',
            name: 'Numero'
        }, {
            fieldLabel: 'EstatusSiniestro',
            name: 'EstatusSiniestro',
            xtype: 'enum.combo',
            enumName: 'Cognitum.Dominio.Polizas.EstatusSiniestroEnum'
        }]
    }, {
        title: 'Bitacora',
        items: [{
            hideLabel: true,
            name: 'Bitacora',
            entityName: 'BitacoraSiniestro',
            xtype: 'ag.list',
            context: 'b.Siniestro.Id=? or b.Siniestro.Id in (select c.Id from ComplementoSiniestro c where c.Siniestro.Id = ?)',
            anchor: '99% 99%'
        }]
    }, {
        title: 'Documentos',
        items: [{
            fieldLabel: 'Documentos',
            hideLabel: true,
            name: 'Documentos',
            entityName: 'DocumentoDigitalizadoSiniestro',
            xtype: 'ag.list',
            context: 'd.Poliza.Id=?',
            anchor: '99% 99%'
            }]
        }, {
        xtype: 'aud.editor',
        title: 'Auditoria'
    }],
    
    initComponent: function(){
        Cognitum.Polizas.Siniestro.Editor.superclass.initComponent.apply(this, arguments);
    },
	
    getTBarDynamicControls: function(value){
		if(value.Id > 0) {
		    var cartaEntity = Karma.Core.ModuleManager.Instance.getEntity('Cartas');		    
	        return [{
				fn: cartaEntity.getMenuSiniestro,
				params: value.Id,
				scope: cartaEntity
			}];
		}
    },
    
    onLoad: function(value){
        Cognitum.Polizas.Siniestro.Editor.superclass.onLoad.apply(this, arguments);
    }
    
});

Ext.reg('sin.editor', Cognitum.Polizas.Siniestro.Editor);
